

<template>
  <el-dialog v-model="dialogTableVisible"
             title="审核流程"
             :close-on-click-modal="false"
             width="80%">
         <div>
           <el-descriptions
               class="margin-top"
               title="人员详情"
               :column="3"
               border
               label-width="150"
           >
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   姓名
                 </div>
               </template>
               {{dateils.name}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   人事单位
                 </div>
               </template>
               {{dateils.hrUnitName}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   职工号
                 </div>
               </template>
               {{dateils.account}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   手机号
                 </div>
               </template>
               {{dateils.mobile}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   职称
                 </div>
               </template>
               {{dateils.titleName}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   所属单位
                 </div>
               </template>
               {{dateils.unitName}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   科学研究领域
                 </div>
               </template>
               {{dateils.searchName}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   一级学科
                 </div>
               </template>
               {{dateils.firstLevel}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   政治面貌
                 </div>
               </template>
               {{getpolityName(dateils.polityId)}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   杰出人才
                 </div>
               </template>
               {{ getHonorTitleName(dateils.honorTitleId) }}
               <!--          {{dateils.honorTitleId}}-->
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   硕导/博导
                 </div>
               </template>
               {{ getTutorTypeName(dateils.tutorTypeId) }}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   最后学历
                 </div>
               </template>
               {{ getEduLevelName(dateils.eduLevelId) }}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   最后学位
                 </div>
               </template>
               {{ getEduDegreeName(dateils.eduDegreeId) }}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   毕业院校
                 </div>
               </template>
               {{dateils.graduateSchool}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   英文名
                 </div>
               </template>
               {{dateils.nameEn}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   电子邮件
                 </div>
               </template>
               {{dateils.email}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   办公电话
                 </div>
               </template>
               {{dateils.telOffice}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   在职情况
                 </div>
               </template>
               <span v-if="dateils.personState==1">
            在职
          </span>
               <span v-if="dateils.personState==3">
            离职
          </span>
               <span v-if="dateils.personState==2">
            退休
          </span>
               <!--          {{dateils.personState}}-->
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   性别
                 </div>
               </template>
               {{dateils.sexId==1?'男':'女'}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   出生日期
                 </div>
               </template>
               {{dateils.birthday}}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
                 <div class="cell-item">
                   身份证号/护照号
                 </div>
               </template>
               {{dateils.idCard}}
             </el-descriptions-item>
             <el-descriptions-item  span="3">
               <template #label>
                 <div class="cell-item">
                   研究方向
                 </div>
               </template>
               {{dateils.researchField}}
             </el-descriptions-item>
             <el-descriptions-item  span="3">
               <template #label>
                 <div class="cell-item">
                   教育经历
                 </div>
               </template>
               {{dateils.researchField}}
             </el-descriptions-item>
             <el-descriptions-item  span="3">
               <template #label>
                 <div class="cell-item">
                   出国经历
                 </div>
               </template>
               {{dateils.experienceAbroad}}
             </el-descriptions-item>
             <el-descriptions-item  span="3">
               <template #label>
                 <div class="cell-item">
                   进修培训情况
                 </div>
               </template>
               {{dateils.learning}}
             </el-descriptions-item>
             <el-descriptions-item  span="3">
               <template #label>
                 <div class="cell-item">
                   学术及社会兼职
                 </div>
               </template>
               {{dateils.parttime}}
             </el-descriptions-item>
           </el-descriptions>
         </div>

          <div>
            <Checkcomponents :procInsId="procInsId" @success="success" class="mt-[10px]" />
          </div>
  </el-dialog>
</template>
<script setup lang="ts">
import Checkcomponents from "@/views/flowable/processInstance/detail/components.vue";
import {ElMessage} from "element-plus";
const procInsId = ref('')
const dialogTableVisible = ref(false)
const emit = defineEmits(['Getlist'])
import {personDetailsView,getCategory,researcherNavApi} from "@/api/researcherNavApi/researcherNavApi"

const getpolityName = (polityid)=>{
  if (polityid === undefined || polityid == null) {
    return '未知';
  }else{
    // getzhengzhimianmaoOptions()
    const matchedOption = zhengzhimianmaoOptions.value.find(item => item.code === polityid);
    return matchedOption? matchedOption.name : '未知';
  }

}
//政治面貌
const zhengzhimianmaoOptions = ref([])
const getzhengzhimianmaoOptions =function () {
  getCategory(
      {
        'bizName':'政治面貌'
      }
  )
      .then((res)=>{

        zhengzhimianmaoOptions.value = res.data
      })
}

const success = function (){
  emit('Getlist')
  dialogTableVisible.value = false
}
const openaudit = function (row){
  if(row.processInstanceId == null){
    ElMessage({
      message: 'processInstanceId为空',
      type: "error"
    });
    return
  }
  dialogTableVisible.value = true

  console.log(row)
  personDetails(
      {id:row.id}
  )
      .then((res)=>{
        Object.assign(dateils,res.data[0])
      })
  procInsId.value = row.processInstanceId
  getzhengzhimianmaoOptions()
}
//详情
import {personDetails} from "@/api/researcherNavApi/researcherNavApi"
import {ElMessageBox} from "element-plus";
import {defineEmits, ref} from "vue";
const getTutorTypeName = (tutorTypeId) => {
  if (tutorTypeId === undefined || tutorTypeId == null) {
    return '未知';
  }
  const tutorTypeMap = {
    1: '博导',
    2: '硕导',
    3: '非导师'
  };
  return tutorTypeMap[tutorTypeId] || '未知';
};

const getEduLevelName = (eduLevelId) => {
  if (eduLevelId === undefined || eduLevelId == null) {
    return '未知';
  }
  const eduLevelMap = {
    3: '大专',
    4: '中专',
    0: '博士研究生',
    1: '硕士研究生',
    2: '本科',
    5: '其他'
  };
  return eduLevelMap[eduLevelId] || '未知';
};

const getEduDegreeName = (eduDegreeId) => {
  if (eduDegreeId === undefined || eduDegreeId == null) {
    return '未知';
  }
  const eduDegreeMap = {
    2: '博士',
    3: '硕士',
    4: '学士',
    999: '无'
  };
  return eduDegreeMap[eduDegreeId] || '未知';
};
const getHonorTitleName = (honorTitleIds) => {
  if (honorTitleIds === undefined || honorTitleIds == null) {
    return '未知';
  }
  const honorTitleMap = {
    1: '院士',
    2: '突出青年',
    3: '长江学者',
    4: '其他'
  };
  const ids = honorTitleIds.split(',');
  const names = ids.map((id) => honorTitleMap[id] || '未知');
  return names.join(', ');
};
let dateils = reactive({})


// 暴露 openDialog 方法供父组件调用
defineExpose({
  openaudit
});
</script>
<style scoped lang="scss">

</style>